package cn.tedu.car.interceptor拦截器面向切面编程打印执行时间;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
*@author: 吴立涛
*@version 创建时间：2021-2-2717:42:03
*类说明：
*/
//实现WebMvcConfigurer接口
//@Configuration		//告诉spring框架，我是一个配置类
public class SysIntercptorConfig配置类备注并实现HandlerInterceptor并注册自己的拦截器 implements WebMvcConfigurer{
	@Autowired
	private MyInterceptor实现HandlerInterceptorb接口并写3个拦截器 myic;
	@Autowired
	private TimeInterceptor系统执行时间 timeic;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//注册自己写的拦截器，如果是多个拦截器，形成一个拦截器链
		//拦截器链执行顺序，前面先后出
		//myic.pre > timeic.pre > timeic.post > myic.post
		registry.addInterceptor(myic);
		registry.addInterceptor(timeic);
	}
}